﻿namespace MatrixRotatingWalk
{
    using System;

    internal class MatrixRotatingWalkDemo
    {
        internal static void Main(string[] args)
        {
            int matrixSize = ReadInput();
            Matrix matrix = new Matrix(matrixSize);

            matrix.GenerateMatrix();
            matrix.PrintToConsole();
        }

        private static int ReadInput()
        {
            Console.Write("Enter a positive number: ");
            string input = Console.ReadLine();
            int inputNumber = 0;
            while (!int.TryParse(input, out inputNumber) || inputNumber < 0 || inputNumber > 100)
            {
                Console.WriteLine("You haven't entered a correct positive number. The number must be between 0 and 100.");
                input = Console.ReadLine();
            }

            return inputNumber;
        }
    }
}